<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>借阅管理_退还管理</title>
	<meta name="decorator" content="default"/>
    <style>
        input::-ms-input-placeholder{
            text-align: center;
        }
        input::-webkit-input-placeholder{
            text-align: center;
        }
    </style>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});

		function selectBookOut() {
            var url ="${ctx}/book/out/bookOut/selectBookOutList"
            $.jBox.open("iframe:"+url, "选择已借阅书籍", $(document).width()*0.9, $(document).height()*0.7 > 600 ? 600 : $(document).height()*0.7, {
                buttons: {"确认":"ok", "关闭":true}, submit: function (v, h, f) {
                    if (v=="ok") {
                        var selectedRow = null;
                        selectedRow = h.find("iframe")[0].contentWindow.$("input:radio:checked");

                        //当选中填入选中内容,未选保持原数据
                        if (selectedRow.val() != null && selectedRow.val() != '') {
                            $("#inCardId").val(selectedRow.attr("inCardId"));
                            $("#inReaderId").val(selectedRow.attr("inReaderId"));
                            $("#inReaderName").val(selectedRow.attr("inReaderName"));
                            $("#inBookCatalogPName").val(selectedRow.attr("inBookCatalogPName"));
                            $("#inBookCatalogName").val(selectedRow.attr("inBookCatalogName"));
                            $("#inBookCode").val(selectedRow.attr("inBookCode"));
                            $("#inBookId").val(selectedRow.attr("inBookId"));
                            $("#bookOutId").val(selectedRow.attr("bookOutId"));
                            $("#inBookName").val(selectedRow.attr("inBookName"));
                        }
                    }
                }, loaded: function (h) {
                    $(".jbox-content", document).css("overflow-y", "hidden");
                }
            });
        }

	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/book/in/bookIn/">退还列表</a></li>
		<li class="active"><a href="${ctx}/book/in/bookIn/form?id=${bookIn.id}">退还<shiro:hasPermission name="book:in:bookIn:edit">${not empty bookIn.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="book:in:bookIn:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="bookIn" action="${ctx}/book/in/bookIn/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
        <div class="control-group">
            <label class="control-label">借阅证ID：</label>
            <div class="controls">
                <input style="width: 270px" type="text" id="inCardId" name="inCardId" value="${bookIn.inCardId}" readonly="true" onclick="selectBookOut()" placeholder="---点击选择已借阅书籍---"/>
                <span class="help-inline"><font color="red">*</font> </span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">学号：</label>
            <div class="controls">
                <input style="width: 270px" type="text" id="inReaderId" name="baseCard.cardStuId" value="${bookIn.baseCard.cardStuId}" readonly="true" onclick="selectBookOut()" placeholder="---点击选择已借阅书籍---"/>
                <span class="help-inline"><font color="red">*</font> </span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">姓名：</label>
            <div class="controls">
                <input style="width: 270px" type="text" id="inReaderName" name="baseCard.baseReader.readerName" value="${bookIn.baseCard.baseReader.readerName}" readonly="true" onclick="selectBookOut()" placeholder="---点击选择已借阅书籍---"/>
                <span class="help-inline"><font color="red">*</font> </span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">书籍大类：</label>
            <div class="controls">
                <input style="width: 270px" type="text" id="inBookCatalogPName" name="baseBook.bookCatalogP.name" value="${bookIn.baseBook.bookCatalogP.name}" readonly="true" onclick="selectBookOut()" placeholder="---点击选择已借阅书籍---"/>
                <span class="help-inline"><font color="red">*</font> </span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">书籍小类：</label>
            <div class="controls">
                <input style="width: 270px" type="text" id="inBookCatalogName" name="baseBook.bookCatalog.name" value="${bookIn.baseBook.bookCatalog.name}" readonly="true" onclick="selectBookOut()" placeholder="---点击选择已借阅书籍---"/>
                <span class="help-inline"><font color="red">*</font> </span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">书籍编号：</label>
            <div class="controls">
                <input style="width: 270px" type="text" id="inBookCode" name="baseBook.bookCode" value="${bookIn.baseBook.bookCode}" readonly="true" onclick="selectBookOut()" placeholder="---点击选择已借阅书籍---"/>
                <span class="help-inline"><font color="red">*</font> </span>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">借阅书籍：</label>
            <div class="controls">
                <input type="hidden" id="inBookId" name="inBookId" value="${bookIn.inBookId}"/>
                <input type="hidden" id="bookOutId" name="bookOutId" value="${bookIn.bookOutId}"/>
                <input style="width: 270px" type="text" id="inBookName" name="baseBook.bookName" value="${bookIn.baseBook.bookName}" readonly="true" onclick="selectBookOut()" placeholder="---点击选择已借阅书籍---"/>
                <span class="help-inline"><font color="red">*</font> </span>
            </div>
        </div>
		<div class="form-actions">
			<shiro:hasPermission name="book:in:bookIn:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>